Skip to content

Fix state carry-over in red tag function#15

Open
wangz539 wants to merge 1 commit intoOpenPBEE:atc138_prp_updatesfrom
hgp297:ziyi_dev
Open

Fix state carry-over in red tag function#15
wangz539 wants to merge 1 commit intoOpenPBEE:atc138_prp_updatesfrom
hgp297:ziyi_dev

Conversation

@wangz539
Copy link

Summary

This PR introduces minor fixes to the red-tag function:

  • Fix a state carry-over issue in fn_red_tag.m that can lead to incorrect red-tag calculations.
  • Add default initialization of red_tag_options in main_PBEErecovery.m to maintain compatibility.

Files Modified:

  • fn_red_tag.m
  • main_PBEErecovery.m

1. Fix: reset series arrays in fn_red_tag.m

Issue:

The arrays used to accumulate damage and component quantities for each structural series (ser_dmg and ser_qty) are populated column-by-column inside a loop over structural series. Therefore, when structural systems contain multiple series, previously allocated columns can carry over and lead to incorrect red-tag calculations.

Fix:

Reset and allocate arrays explicitly for each structural system:

ser_dmg = zeros(num_reals, length(series));
ser_qty = zeros(num_reals, length(series));

2. Fix: initialize sys_tag for each direction

Issue:

sys_tag was populated inside the loop over structural systems but not explicitly initialized for each direction. Again, this could cause residual values from previous iterations to carry over when computing.

Fix:

sys_tag is now initialized inside the direction loop:

sys_tag = false(num_reals, length(structural_systems));

3. Compatibility improvement in main_PBEErecovery.m

Issue:

Recent updates introduce red_tag_options. Existing workflows that do not define this field will encounter the error: Unrecognized field name "red_tag_options" when the code attempts to access it.

Fix:

Default values are assigned when red_tag_options or its fields are missing:

if ~isfield(functionality_options,'red_tag_options') || isempty(functionality_options.red_tag_options)
    functionality_options.red_tag_options = struct();
end

if ~isfield(functionality_options.red_tag_options,'ignore_coupling_beam_for_red_tag')
    functionality_options.red_tag_options.ignore_coupling_beam_for_red_tag = false;
end

if ~isfield(functionality_options.red_tag_options,'tag_coupling_beams_over_height')
    functionality_options.red_tag_options.tag_coupling_beams_over_height = false;
end

The original default behavior is preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant